package org.tigris.subversion.svnant.commands;

import java.io.File;
import org.tigris.subversion.svnant.SvnAntUtilities;
import org.tigris.subversion.svnclientadapter.ISVNClientAdapter;
import org.tigris.subversion.svnclientadapter.SVNClientException;
import org.tigris.subversion.svnclientadapter.SVNRevision;
import org.tigris.subversion.svnclientadapter.SVNUrl;

public class Copy extends SvnCommand
{
  private static final String MSG_CANT_COPY = "Can't copy";
  private File srcPath = null;
  private File destPath = null;
  private SVNUrl srcUrl = null;
  private SVNUrl destUrl = null;
  private boolean makeparents = false;
  private SVNRevision revision = SVNRevision.HEAD;
  private String message = null;

  public void execute()
  {
    try
    {
      if (this.srcPath != null)
      {
        if (this.destPath != null)
          getClient().copy(this.srcPath, this.destPath);
        else
          getClient().copy(this.srcPath, this.destUrl, this.message);
      }
      else if (this.destPath != null)
        getClient().copy(this.srcUrl, this.destPath, this.revision);
      else
        getClient().copy(this.srcUrl, this.destUrl, this.message, this.revision, this.makeparents);
    }
    catch (SVNClientException localSVNClientException)
    {
      throw ex(localSVNClientException, "Can't copy", new Object[0]);
    }
  }

  protected void validateAttributes()
  {
    SvnAntUtilities.attrsNotSet("srcPath, srcUrl", true, new Object[] { this.srcPath, this.srcUrl });
    SvnAntUtilities.attrsNotSet("destPath, destUrl", true, new Object[] { this.destPath, this.destUrl });
    SvnAntUtilities.attrNotNull("revision", this.revision);
    if (this.destUrl != null)
      SvnAntUtilities.attrNotEmpty("message", this.message);
  }

  public void setSrcPath(File paramFile)
  {
    this.srcPath = paramFile;
  }

  public void setDestPath(File paramFile)
  {
    this.destPath = paramFile;
  }

  public void setSrcUrl(SVNUrl paramSVNUrl)
  {
    this.srcUrl = paramSVNUrl;
  }

  public void setDestUrl(SVNUrl paramSVNUrl)
  {
    this.destUrl = paramSVNUrl;
  }

  public void setMessage(String paramString)
  {
    this.message = paramString;
  }

  public void setRevision(String paramString)
  {
    this.revision = getRevisionFrom(paramString);
  }

  public void setMakeParents(boolean paramBoolean)
  {
    this.makeparents = paramBoolean;
  }
}

/* Location:           C:\Users\Administrator\Desktop\svnant.jar
 * Qualified Name:     org.tigris.subversion.svnant.commands.Copy
 * JD-Core Version:    0.6.0
 */